package com.macro.mall.service.impl;

import com.github.pagehelper.PageHelper;
import com.macro.mall.mapper.UmsCommunityAgentMapper;
import com.macro.mall.model.UmsCommunityAgent;
import com.macro.mall.param.AddCommunityAgentParam;
import com.macro.mall.service.CommunityAgentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommunityAgentServiceImpl implements CommunityAgentService {

    private final UmsCommunityAgentMapper umsCommunityAgentMapper;

    @Autowired
    public CommunityAgentServiceImpl(UmsCommunityAgentMapper umsCommunityAgentMapper) {
        this.umsCommunityAgentMapper = umsCommunityAgentMapper;
    }

    @Override
    public List<UmsCommunityAgent> listAll(Integer pageSize, Integer pageNum){
        PageHelper.startPage(pageNum,pageSize);
        return umsCommunityAgentMapper.selectAll();
    }


    @Override
    public Long addCommunityAgent(AddCommunityAgentParam addCommunityAgentParam) {
        return Long.valueOf(umsCommunityAgentMapper.insert(null));
    }
}
